import csv_read
import cv2
import numpy as np

if __name__ == '__main__':

    ir_array = csv_read.read_img_from_csv(r"F:\工作\红外三维\处理后数据\csv\160622AA\AA062210.csv")
    min_temp = np.min(ir_array)
    max_temp = np.max(ir_array)
    print(min_temp)
    print(max_temp)
    
    ir_scale = (ir_array - np.ones(np.shape(ir_array)) * min_temp) * (1 / (max_temp - min_temp))

    max_pix_value = 65535#int((max_temp - min_temp) / 0.01)

    ir_gray = np.uint16(ir_scale * max_pix_value)
    cv2.imwrite('AA062210.tif', ir_gray)

    print(max_pix_value)
    print(ir_gray)
    print(np.max(ir_gray))